package me.ingxin.android.permission2.ext

import android.content.Context
import android.content.Intent
import android.net.Uri
import android.os.Build
import android.provider.Settings
import me.ingxin.android.permission2.PERMISSION_WRITE_SETTINGS
import me.ingxin.android.permission2.targetSdkVersion

/**
 * Created on 2023/7/16 by yin
 * Manifest.permission.WRITE_SETTINGS
 */
internal class WriteSettingsPermissionTask : BaseSpecialPermissionsTask() {

    override val permission = PERMISSION_WRITE_SETTINGS

    override fun showRequestPermission(context: Context): Boolean {
        return context.targetSdkVersion >= Build.VERSION_CODES.M
    }

    override fun crateInput(context: Context): Intent {
        return Intent(
            Settings.ACTION_MANAGE_WRITE_SETTINGS, Uri.parse("package:${context.packageName}")
        )
    }
}